package org.deltaset.samples.mvc.domain;

import java.util.Date;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.persistence.Entity;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import javax.persistence.Enumerated;
import org.deltaset.samples.mvc.reference.Specialty;

@Entity
public class Vet extends AbstractPerson {

    @NotNull
    @Past
    @Temporal(TemporalType.TIMESTAMP)
    // @DateTimeFormat(style = "M-")
    //TODO: add support for java.util.Calendar
    private Date employedSince;
    @Enumerated
    private Specialty specialty;

    public Date getEmployedSince() {
        return this.employedSince;
    }

    public void setEmployedSince(Date employedSince) {
        this.employedSince = employedSince;
    }

    public Specialty getSpecialty() {
        return this.specialty;
    }

    public void setSpecialty(Specialty specialty) {
        this.specialty = specialty;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("Address: ").append(getAddress()).append(", ");
        sb.append("BirthDay: ").append(getBirthDay()).append(", ");
        sb.append("City: ").append(getCity()).append(", ");
        sb.append("Email: ").append(getEmail()).append(", ");
        sb.append("EmployedSince: ").append(getEmployedSince() == null ? "null" : getEmployedSince().getTime()).append(", ");
        sb.append("FirstName: ").append(getFirstName()).append(", ");
        sb.append("HomePage: ").append(getHomePage()).append(", ");
        sb.append("Id: ").append(getId()).append(", ");
        sb.append("LastName: ").append(getLastName()).append(", ");
        sb.append("Specialty: ").append(getSpecialty()).append(", ");
        sb.append("Telephone: ").append(getTelephone()).append(", ");
        sb.append("Version: ").append(getVersion());
        return sb.toString();
    }
}
